package main

import (
	"context"
	"fmt"
	"google.golang.org/grpc"
	pb "grpc_demo/grpc_error/grpc_error"
)

func main() {
	// 建立连接
	coon, err := grpc.Dial("127.0.0.1:8088", grpc.WithInsecure())
	if err != nil {
		fmt.Println(err)
		return
	}
	defer coon.Close()

	// 创建客户端
	c := pb.NewGreeterClient(coon)
	// 调用服务
	r, err := c.SayHelloAgain(context.Background(), &pb.HelloRequest{Name: " jxl"})
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(r.Message)
}
